package edu.ynmd.com.config;


import org.springframework.boot.jdbc.DataSourceBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.sqlite.SQLiteDataSource;

import javax.sql.DataSource;
@Configuration
public class DataSourceConfiguration {

    @Bean(destroyMethod = "",name = "EmbeddeddataSource")
    public DataSource dataSource(){
        DataSourceBuilder dataSourceBuilder=DataSourceBuilder.create();
        dataSourceBuilder.driverClassName("org.sqlite.JDBC");

        //数据库文件位置
        dataSourceBuilder.url("jdbc:sqlite:"+"data.sqlite");
        dataSourceBuilder.type(SQLiteDataSource.class);
        return dataSourceBuilder.build();
    }
}
